#include "Utility.hh"
#include <random>
#include <sstream>
#include <iomanip>
#include <ctime>

std::string Utility::generateAccountID(int accountType) {
    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_int_distribution<> dis(1000, 9999);

    std::ostringstream oss;
    oss << "62" << std::setw(2) << std::setfill('0') << accountType
        << "-" << std::setw(4) << std::setfill('0') << dis(gen)
        << "-" << std::setw(4) << std::setfill('0') << dis(gen)
        << "-" << std::setw(4) << std::setfill('0') << dis(gen);
    return oss.str();
}

std::string Utility::getCurrentDateTime() {
    std::time_t t = std::time(nullptr);
    char mbstr[100];
    std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d_%H-%M-%S", std::localtime(&t));
    return std::string(mbstr);
}

void Utility::clearScreen() {
    system("cls");
    std::cin.clear();
    std::cin.ignore(100, '\n');
}
void Utility::pressEnterToContinue() {
    std::cout << "Press Enter to continue...";
    std::cin.ignore(100, '\n');
    std::cin.get();
}